package com.ruoyi.system.service.impl;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.entity.PreventionRiskOughtFile;
import com.ruoyi.system.mapper.PreventionRiskOughtFileMapper;
import com.ruoyi.system.service.PreventionRiskOughtFileService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 风险应知卡附件表 服务实现类
 * </p>
 * @since 2023-03-10
 */
@Service("preventionRiskOughtFileService")
public class PreventionRiskOughtFileServiceImpl implements PreventionRiskOughtFileService {

    @Resource
    private PreventionRiskOughtFileMapper preventionRiskOughtFileMapper;

    @Override
    public List<PreventionRiskOughtFile> queryByPage(PreventionRiskOughtFile riskOughtFile) {
        return preventionRiskOughtFileMapper.queryAllByLimit(riskOughtFile);
    }

    @Override
    public PreventionRiskOughtFile queryById(Integer id) {
        return this.preventionRiskOughtFileMapper.queryById(id);
    }

    @Override
    public PreventionRiskOughtFile insert(PreventionRiskOughtFile riskOughtFile) {
        riskOughtFile.setCreateUser(SecurityUtils.getUsername());
        this.preventionRiskOughtFileMapper.insert(riskOughtFile);
        return riskOughtFile;
    }

    @Override
    public PreventionRiskOughtFile update(PreventionRiskOughtFile riskOughtFile) {
        this.preventionRiskOughtFileMapper.update(riskOughtFile);
        return this.queryById(riskOughtFile.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return this.preventionRiskOughtFileMapper.deleteById(id) > 0;
    }
}
